<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html>
<head>
<title>Introduction to GTK#</title>
<link rel="stylesheet" href="/cfg/format.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="GUI, Introduction to GTK#, GTK# library, C#, linux, programming">
<meta name="description" content="This chapter is an introduction to GTK# toolkit.">
<meta name="language" content="en">
<meta name="author" content="Jan Bodnar">
<meta name="distribution" content="global">

<script type="text/javascript" src="/lib/jquery.js"></script>
<script type="text/javascript" src="/lib/common.js"></script>

</head>

<body>

<div class="container2">

<div id="wide_ad" class="ltow">
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* 160x600, August 2011 */
google_ad_slot = "2484182563";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<div class="content2">


<a href="/" title="Home">Home</a>&nbsp;
<a href="..">Contents</a>


<h1>Introduction to GTK#</h1>


<p>
This is an introductory GTK# programming tutorial. The tutorial is 
targeted for the C# programming language. It has been created and 
tested on Linux. The GTK# programming tutorial is suited for novice and 
intermediate programmers. Here are the <a href="/img/gui/sharpgtk/images.tgz">images</a> 
used in this tutorial. 
</p>

<div class="big_hor">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-9706709751191532";
/* big_horizontal */
google_ad_slot = "2904953388";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<h2>GTK+</h2>

<p>
The <b>GTK+</b> is a library for creating graphical user interfaces. 
The library is created in C programming language. The GTK+ library is also 
called the GIMP Toolkit. Originally, the library was created while developing 
the GIMP image manipulation program. Since then, the GTK+ became one of the most 
popular toolkits under Linux and BSD Unix. Today, most of the GUI software in 
the open source world is created in Qt or in GTK+. The GTK+ is an object oriented 
application programming interface. The object oriented system is created with the
Glib object system, which is a base for the GTK+ library. The <b>GObject</b> 
also enables to create language bindings for various other programming languages. 
Language bindings exist for C++, Python, Perl, Java, C# and other programming languages. 
</p>

<p>
The GTK+ itself depends on the following libraries. 
</p>

<ul>
<li>Glib</li>
<li>Pango</li>
<li>ATK</li>
<li>GDK</li>
<li>GdkPixbuf</li>
<li>Cairo</li>
</ul>

<p>
The <b>Glib</b> is a general purpose utility library. It 
provides various data types, string utilities, enables error reporting, message 
logging, working with threads and other useful programming features. 
The <b>Pango</b> is a library which enables internationalization. 
The <b>ATK</b> is the accessibility toolkit. This toolkit provides 
tools which help physically challenged people work with computers. The 
<b>GDK</b> is a wrapper around the low-level drawing and windowing 
functions provided by the underlying graphics system. On Linux, GDK lies between 
the X Server and the GTK+ library. Recently, much of it's functionality have been 
delegated to the Cairo library. The <b>GdkPixbuf</b> library is a 
toolkit for image loading and pixel buffer manipulation. <b>Cairo</b> 
is a library for creating 2D vector graphics. It has been included in GTK+ 
since version 2.8.
</p>

<p>
Gnome and XFce desktop environments have been created using the GTK+ library. 
SWT and wxWidgets are well known  programming frameworks, that use GTK+. 
Prominent software applications that use GTK+ include Firefox or Inkscape.
</p>

<h2>GTK#</h2>

<p>
GTK# is a wrapper over the GTK+ for the C# programming language. The library facilitates building graphical 
GNOME applications using Mono or any other compliant CLR. 
Gtk# is an event-driven system like any other modern windowing library where every widget 
in an application has handler methods that get called when particular events happen.
Applications built using Gtk# will run on many platforms including Linux, Microsoft Windows and Mac OS X.
GTK# is part of the Mono initiative. There are basically two widget toolkits in Mono. The
<b>Winforms</b> and the GTK#. The GTK# is considered to be native for the Linux/Unix operating system. 
</p>


<h2>Compiling GTK# applications</h2>

<p>
We use the gmcs compiler to compile our GTK# applications.
</p>

<pre>
$ gmcs -pkg:gtk-sharp-2.0 -r:/usr/lib/mono/2.0/Mono.Cairo.dll application.cs
</pre>

<p>
The above line compiles a GTK# application, that also uses the Cairo library.
</p>


<h2>Sources</h2>

<ul>
<li><a href="http://www.go-mono.com">go-mono.com</a></li>
<li><a href="http://wwww.wikipedia.org">wikipedia.org</a></li>
</ul>


<p>
In this part of the GTK# tutorial, we have introduced the GTK# library.
</p>


<div class="center">
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* horizontal */
google_ad_slot = "1734478269";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<br>


<div class="botNav, center">
<span class="botNavItem"><a href="/">Home</a></span> ‡ <span class="botNavItem"><a href="..">Contents</a></span> ‡ 
<span class="botNavItem"><a href="#">Top of Page</a></span>
</div>


<div class="footer">
<div class="signature">
<a href="/">ZetCode</a> last modified March 30, 2008  <span class="copyright">&copy; 2007 - 2013 Jan Bodnar</span>
</div>
</div>

</div> <!--content -->

</div> <!--container -->

</body>
</html>

